<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #ondiv {
      background: #000;
      width: 200px;
      height: 50px;
    }

    .test {
      background: red;
      width: 100px;
      height: 100px;
      transition: all 1s;
    }

    .test-hover {
      background: yellow;
      width: 200px;
      height: 200px;
    }
  </style>
</head>

<body>
  <!-- 动画可以使用animate.css来帮助实现 -->
  <div id="ondiv">JS transition</div>
  <p></p>
  <div id="div" class="test"></div>
  <script type="text/javascript">
    //onmouseover
    document.getElementById("ondiv").onclick = function () {
      document.getElementById("div").className = 'test test-hover';
      //document.getElementById("div").style.width="200px"
      //document.getElementById("div").style.height="200px"
    }
    document.getElementById("ondiv").onmouseleave = function () {
      document.getElementById("div").className = 'test';
      //document.getElementById("div").style.width="200px"
      //document.getElementById("div").style.height="200px"
    }
  </script>
</body>

</html>